package lab_10.com.acme.bankapp.domain.bank;

public class SavingsAccount extends AbstractAccount  {

	public SavingsAccount(double balance) {
		super(balance);
	}
	
	@Override
	public void withdraw(double amount) {
		if (balance >= amount) {
			balance -= amount;
		}
	}

	@Override
	public double maximumAmountToWithdraw() {
		return (balance>=0)?balance:0;
	}
	
	@Override
	public void printAllAccountData() {
		System.out.println("Savings account.");
		System.out.format("Balance: %1$f\n",balance);
		System.out.format("Maximum amount to withdraw: %1$f\n",maximumAmountToWithdraw());
	}
}
